﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace GPCSC.Web.CL_USER_S
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtUSERNAME.Text.Trim().Length==0)
			{
				strErr+="USERNAME不能为空！\\n";	
			}
			if(this.txtPWD.Text.Trim().Length==0)
			{
				strErr+="PWD不能为空！\\n";	
			}
			if(this.txtREALNAME.Text.Trim().Length==0)
			{
				strErr+="REALNAME不能为空！\\n";	
			}
			if(this.txtREMARK.Text.Trim().Length==0)
			{
				strErr+="REMARK不能为空！\\n";	
			}
			if(this.txtDepartName.Text.Trim().Length==0)
			{
				strErr+="DepartName不能为空！\\n";	
			}
			if(this.txtPOSTName.Text.Trim().Length==0)
			{
				strErr+="POSTName不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtcreates.Text))
			{
				strErr+="creates格式错误！\\n";	
			}
			if(this.txtTEL.Text.Trim().Length==0)
			{
				strErr+="TEL不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtENABLED.Text))
			{
				strErr+="ENABLED格式错误！\\n";	
			}
			if(this.txtUrlImage.Text.Trim().Length==0)
			{
				strErr+="UrlImage不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtLoginTime.Text))
			{
				strErr+="LoginTime格式错误！\\n";	
			}
			if(this.txtPD_CompanyName.Text.Trim().Length==0)
			{
				strErr+="PD_CompanyName不能为空！\\n";	
			}
			if(this.txtidenID.Text.Trim().Length==0)
			{
				strErr+="idenID不能为空！\\n";	
			}
			if(this.txtContact.Text.Trim().Length==0)
			{
				strErr+="Contact不能为空！\\n";	
			}
			if(this.txtE_mail.Text.Trim().Length==0)
			{
				strErr+="E_mail不能为空！\\n";	
			}
			if(this.txtstate.Text.Trim().Length==0)
			{
				strErr+="state不能为空！\\n";	
			}
			if(this.txtCL_ROLEname.Text.Trim().Length==0)
			{
				strErr+="CL_ROLEname不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string USERNAME=this.txtUSERNAME.Text;
			string PWD=this.txtPWD.Text;
			string REALNAME=this.txtREALNAME.Text;
			string REMARK=this.txtREMARK.Text;
			string DepartName=this.txtDepartName.Text;
			string POSTName=this.txtPOSTName.Text;
			DateTime creates=DateTime.Parse(this.txtcreates.Text);
			string TEL=this.txtTEL.Text;
			int ENABLED=int.Parse(this.txtENABLED.Text);
			string UrlImage=this.txtUrlImage.Text;
			DateTime LoginTime=DateTime.Parse(this.txtLoginTime.Text);
			string PD_CompanyName=this.txtPD_CompanyName.Text;
			string idenID=this.txtidenID.Text;
			string Contact=this.txtContact.Text;
			string E_mail=this.txtE_mail.Text;
			string state=this.txtstate.Text;
			string CL_ROLEname=this.txtCL_ROLEname.Text;

			GPCSC.Model.CL_USER_S model=new GPCSC.Model.CL_USER_S();
			model.USERNAME=USERNAME;
			model.PWD=PWD;
			model.REALNAME=REALNAME;
			model.REMARK=REMARK;
			model.DepartName=DepartName;
			model.POSTName=POSTName;
			model.creates=creates;
			model.TEL=TEL;
			model.ENABLED=ENABLED;
			model.UrlImage=UrlImage;
			model.LoginTime=LoginTime;
			model.PD_CompanyName=PD_CompanyName;
			model.idenID=idenID;
			model.Contact=Contact;
			model.E_mail=E_mail;
			model.state=state;
			model.CL_ROLEname=CL_ROLEname;

			GPCSC.BLL.CL_USER_S bll=new GPCSC.BLL.CL_USER_S();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
